package jjn.acwing.java_basic;

import java.util.Scanner;

/**
 * @author Jjn
 * @since 2023/9/5 22:48
 */
public class Acwing773 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            String str = scanner.next();
            String subStr = scanner.next();
            char max = str.charAt(0);
            int maxIndex = 0;
            for (int i = 1; i < str.length(); i++) {
                if (str.charAt(i) > max) {
                    max = str.charAt(i);
                    maxIndex = i;
                }
            }
            System.out.println(str.substring(0, maxIndex + 1) + subStr + str.substring(maxIndex + 1));
        }
    }
}
